package com.lutzyt.delivery.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lutzyt.delivery.bean.OrderStateFlow;
import com.lutzyt.delivery.mapper.OrderStateFlowDAO;
import com.lutzyt.delivery.service.OrderStateFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class OrderStateFlowServiceImpl extends ServiceImpl<OrderStateFlowDAO, OrderStateFlow> implements OrderStateFlowService {

  @Autowired
  private OrderStateFlowDAO orderStateFlowDAO;

  @Transactional(readOnly = true)
  @Override
  public OrderStateFlow findById(Integer id) {
    return orderStateFlowDAO.selectById(id);
  }

  @Transactional(readOnly = true)
  @Override
  public IPage<OrderStateFlow> findByPage(int pageNum, int pageSize) {
    return orderStateFlowDAO.selectPage(new Page<>(pageNum, pageSize), null);
  }

  @Override
  public void insert(OrderStateFlow orderStateFlow) {
    orderStateFlowDAO.insert(orderStateFlow);
  }

  @Override
  public void update(OrderStateFlow orderStateFlow) {
    orderStateFlowDAO.updateById(orderStateFlow);
  }

  @Override
  public void deleteById(Integer id) {
    orderStateFlowDAO.deleteById(id);
  }

}